import java.util.HashSet;

public class DistributeCandies {

    public int distributeCandies(int[] candyType) {
        HashSet<Integer> set = new HashSet<>();
        int n = candyType.length / 2;
        for (int i = 0; i < candyType.length; i++) {
            set.add(candyType[i]);
            if (set.size() >= n) return n;
        }
        return set.size();
    }
}
